import { PAGE_SIZE } from '../constants';
import request from '../../../utils/request';

const domain = 'http://118.25.23.157:7001'

export function fetch({ page = 1 }) {
  return request(`${domain}/cfy/devices?page=${page}&count=${PAGE_SIZE}`);
}

export function remove(id) {
  return request(`${domain}/cfy/devices/${id}`, {
    method: 'DELETE',
  });
}

export function patch(id, values) {
  return request(`${domain}/cfy/devices/${id}`, {
    method: 'PUT',
    body: JSON.stringify(values),
  });
}

export function create(values) {
  return request(`${domain}/cfy/devices`, {
    method: 'POST',
    body: JSON.stringify(values),
  });
}
